<?php

/**
 * Created by PhpStorm.
 * User: deng
 * Date: 2015/3/20
 * Time: 22:54
 */

namespace Serve\Utils;

class JWTToken
{
    public static function generateToken($data)
    {
        $data['expire'] = time() + 24 * 60 * 60;
        return \JWT::encode($data, C('JWT.key'));
    }

    public static function parseToken($token)
    {
        return get_object_vars(\JWT::decode($token, C('JWT.key')));
    }
}